package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class CmsGoodSupplier implements Serializable {

	private static final long serialVersionUID = -6126441339628396278L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer catId;
	private java.lang.String supplierName;
	private java.lang.String pic;
	private java.lang.String link;
	private java.lang.Integer displayOrder;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public CmsGoodSupplier() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getCatId() {
		return catId;
	}
	public java.lang.String getSupplierName() {
		return supplierName;
	}
	public java.lang.String getPic() {
		return pic;
	}
	public java.lang.String getLink() {
		return link;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setCatId(java.lang.Integer catId) {
		this.catId = catId;
	}
	public void setSupplierName(java.lang.String supplierName) {
		this.supplierName = supplierName;
	}
	public void setPic(java.lang.String pic) {
		this.pic = pic;
	}
	public void setLink(java.lang.String link) {
		this.link = link;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof CmsGoodSupplier))
			return false;

		final CmsGoodSupplier cmsGoodSupplier = (CmsGoodSupplier)other;
		if (!this.id.equals(cmsGoodSupplier.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("CmsGoodSupplier[")
			.append("id=").append(id).append(", ")
			.append("catId=").append(catId).append(", ")
			.append("supplierName=").append(supplierName).append(", ")
			.append("pic=").append(pic).append(", ")
			.append("link=").append(link).append(", ")
			.append("displayOrder=").append(displayOrder).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}
	///#######
	private CmsHomeCategory homtCategory;
	private String subSupplerName;
	public String getSubSupplerName(){
		if (this.supplierName != null) {
			if (this.supplierName.length()>7) {
				subSupplerName = supplierName.substring(0, 7)+"...";
			} else {
				subSupplerName = supplierName;
			}
		}
		return subSupplerName;
	}
	public String getPicPath() {
        if (pic == null) {
            return null;
        }
        return com.ibuonline.b2b.common.ResourceUtil.getResPath(pic);
	}

	public CmsHomeCategory getHomtCategory() {
		return homtCategory;
	}

	public void setHomtCategory(CmsHomeCategory homtCategory) {
		this.homtCategory = homtCategory;
	}
	
	
}